package P;

import C_A.OCI.ME.pos.CP.X_P_LiangCi;
import ME.VPC.M.app.App;
import S_A.AVQ.OVQ.OSQ.VSQ.obj.WordFrequency;
import S_A.SVQ.stable.S_Maps;
import S_A.SVQ.stable.S_Pos;
import S_A.pheromone.IMV_SQI_SS;

import java.util.List;
/*
 * (A||B)&&C
 * !!((A||B)&&C)
 * !(!(A||B)||!C)
 */
/*
 * 个人著作权人, 作者 罗瑶光, 浏阳
 * yaoguangluo@outlook.com, 313699483@qq.com, 2080315360@qq.com,
 * (lyg.tin@gmail.com2018年回国后因国内G网屏蔽不再使用）
 * 15116110525-浏阳德塔软件开发有限公司-创始人-法人-总经理-永久非盈利-
 * 430181198505250014, G24402609, EB0581342
 * 204925063, 389418686, F2406501, 0626136
 * 湖南省 浏阳市 集里街道 神仙坳社区 大塘冲一段路 208号 阳光家园别墅小区 第十栋别墅 第三层
 * */

public class Pos_X_P_LiangCi extends Pos_X_P_LianCi implements X_P_LiangCi {
	public int P_LiangCiOfThree(List<String> outputList, int countLength,
			String[] strings, StringBuilder[] fixWord) {
		if (wordsForest.containsKey(fixWord[S_Pos.INT_ZERO].toString())) {
			if (S_Maps.mingCi.containsKey(fixWord[S_Pos.INT_ZERO].toString())
					|| S_Maps.daiCi
							.containsKey(fixWord[S_Pos.INT_ZERO].toString())) {
				countLength = charOfThree(countLength, outputList, strings,
						fixWord);//trif-countLength
				return countLength;
			}
			if (S_Maps.liangCi.containsKey(strings[S_Pos.INT_ONE])) {
				outputList.add(strings[S_Pos.INT_ONE]);
				fixWord[S_Pos.INT_ZERO].delete(S_Pos.INT_ZERO,
						fixWord[S_Pos.INT_ZERO].length());
				fixWord[S_Pos.INT_ZERO].append(strings[S_Pos.INT_ONE]);
				return S_Pos.INT_TWO;
			}
			if ((S_Maps.xingWeiCi
					.containsKey(fixWord[S_Pos.INT_ZERO].toString())
					|| S_Maps.xingRongCi
							.containsKey(fixWord[S_Pos.INT_ZERO].toString()))
					&& S_Maps.mingCi.containsKey(strings[S_Pos.INT_ONE])) {
				outputList.add(strings[S_Pos.INT_ONE]);
				fixWord[S_Pos.INT_ZERO].delete(S_Pos.INT_ZERO,
						fixWord[S_Pos.INT_ZERO].length());
				fixWord[S_Pos.INT_ZERO].append(strings[S_Pos.INT_ONE]);
				return S_Pos.INT_TWO;
			}
		}
		fixWord[S_Pos.INT_ZERO].delete(S_Pos.INT_ZERO,
				fixWord[S_Pos.INT_ZERO].length());
		fixWord[S_Pos.INT_ZERO].append(strings[S_Pos.INT_ZERO]);
		outputList.add(strings[S_Pos.INT_ZERO]);
		if (S_Maps.CiTwo.containsKey(strings[S_Pos.INT_TWO])) {
			outputList.add(strings[S_Pos.INT_TWO]);
			fixWord[S_Pos.INT_ZERO].delete(S_Pos.INT_ZERO,
					fixWord[S_Pos.INT_ZERO].length());
			fixWord[S_Pos.INT_ZERO].append(strings[S_Pos.INT_TWO]);
			return S_Pos.INT_THREE;
		}
		return S_Pos.INT_ONE;
	}

	// 离散结合率优化 流水阀门
	public int P_LiangCiOfThreeForMap(IMV_SQI_SS outputList, int countLength,
			String[] strings, StringBuilder[] fixWord, App NE) {
		if (!wordsForest.containsKey(fixWord[S_Pos.INT_ZERO].toString())) {
			return countLength;
		}
		if (S_Maps.mingCi.containsKey(fixWord[S_Pos.INT_ZERO].toString())
				|| S_Maps.daiCi
						.containsKey(fixWord[S_Pos.INT_ZERO].toString())) {
			countLength = charOfThreeForMap(countLength, outputList, strings,
					fixWord, NE);
			return countLength;
		}
		countLength -= S_Pos.INT_THREE;
		if (!wordsForest.containsKey(strings[S_Pos.INT_ONE])) {
			return countLength;
		}
		WordFrequency wordFrequency;
		if (outputList.containsKey(strings[S_Pos.INT_ONE])) {
			wordFrequency = outputList.getW(strings[S_Pos.INT_ONE]);
			wordFrequency
					.I_frequency(wordFrequency.get_frequency() + S_Pos.INT_ONE);
		} else {
			wordFrequency = new WordFrequency(1.0, strings[S_Pos.INT_ONE]);
		}
		wordFrequency.positions.add(NE._I_U.parserCharPosition);
		outputList.put(strings[S_Pos.INT_ONE], wordFrequency);
		fixWord[S_Pos.INT_ZERO].delete(S_Pos.INT_ZERO,
				fixWord[S_Pos.INT_ZERO].length());
		fixWord[S_Pos.INT_ZERO].append(strings[S_Pos.INT_ONE]);
		countLength += S_Pos.INT_TWO;
		return countLength;
	}
}
//	}
//return countLength;
//		}
//		return countLength;

//83 //			wordFrequency= new WordFrequency();
////			wordFrequency.I_frequency(1.0);
////			wordFrequency.I_Word(strings[S_Pos.INT_ONE]);